package com.gy.smart.handle.util;

import com.gy.smart.handle.bean.HandleDetailBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 高岳 on 2016/8/9.
 * Describe:办事详情管理
 */
public class HandleDetailManager {

    private static HandleDetailManager instance;
    private List<IHandleDetailListener> list;

    public static HandleDetailManager getInstance(){
        if(instance == null){
            instance = new HandleDetailManager();
        }
        return instance;
    }

    private HandleDetailManager(){
        list = new ArrayList<>();
    }

    public void addListener(IHandleDetailListener listener){
        if(!list.contains(listener)){
            list.add(listener);
        }
    }

    public void notifyListener(HandleDetailBean detailBean){
        for(IHandleDetailListener listener : list){
            listener.handleDetailChange(detailBean);
        }
    }


    public interface IHandleDetailListener{
        void handleDetailChange(HandleDetailBean detailBean);
    }
}
